package com.wally.netty.client.test;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class Demo {

	public static void main(String[] args) {
		final String filePath = "E:/foo.txt";
		Box box = new Box();
		box.setLength(100);
		box.setWidth(50);
		box.setHeight(30);
		try (FileOutputStream fs = new FileOutputStream(filePath);
				ObjectOutputStream os = new ObjectOutputStream(fs);
				FileInputStream fis = new FileInputStream(filePath);
				ObjectInputStream ois = new ObjectInputStream(fis);) {

			os.writeObject(box);

			Box obj = (Box) ois.readObject();
			ois.close();

			log.info("This is: {}", obj);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

}
